package com.itheima.HomeWork_day08;
/*
自定义泛型类使用
 */
public class GenericTest05 {
    public static void main(String[] args) {

        Box<String> box = new Box<>();
        box.setElement("这是自定义的泛型类!");
        System.out.println(box.getElement());

        Box<Integer> box1 = new Box<>();
        box1.setElement(123);
        System.out.println(box1.getElement());

        Box<Double> box2 = new Box<>();
        box2.setElement(3.1415926);
        System.out.println(box2.getElement());

    }
}

//创建一个泛型类
class Box<T>{

    private T element;

    public T getElement() {
        return element;
    }

    public void setElement(T element) {
        this.element = element;
    }

}